﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

// Token: 0x020003C4 RID: 964
public class ToggleGroupEvent : MonoBehaviour
{
	// Token: 0x06001815 RID: 6165 RVA: 0x0009D670 File Offset: 0x0009B870
	private void Start()
	{
		for (int i = 0; i < this.toggles.Length; i++)
		{
			this.toggles[i].onValueChanged.AddListener(new UnityAction<bool>(this.OnChange));
		}
	}

	// Token: 0x06001816 RID: 6166 RVA: 0x0009D6B4 File Offset: 0x0009B8B4
	private void Update()
	{
		if (this.isChange)
		{
			int arg = -1;
			for (int i = 0; i < this.toggles.Length; i++)
			{
				if (this.toggles[i].isOn)
				{
					arg = i;
					break;
				}
			}
			this.isChange = false;
			this.selEvent.Invoke(arg);
		}
	}

	// Token: 0x06001817 RID: 6167 RVA: 0x0009D714 File Offset: 0x0009B914
	public void OnChange(bool flag)
	{
		this.isChange = true;
	}

	// Token: 0x04001B6E RID: 7022
	public ToggleGroupEvent.ToggleSelectEvent selEvent;

	// Token: 0x04001B6F RID: 7023
	[SerializeField]
	private Toggle[] toggles;

	// Token: 0x04001B70 RID: 7024
	private bool isChange;

	// Token: 0x020003C5 RID: 965
	[Serializable]
	public class ToggleSelectEvent : UnityEvent<int>
	{
	}
}
